<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>退款订单列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
    <style>
        #guide_ul li{
            margin-top: 5px;
        }
    </style>
</head>
<body>
<div id="aaa"></div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">退款订单列表</div>
                <div class="layui-card-body">
                    <div class="layui-form-item layui-form">
                       
                      {if !empty($res)}
                        <div class="layui-inline">
                            <label class="layui-form-label">订单编号</label>
                            <div class="layui-input-block">
                                <select name="order_sn" lay-verify="" lay-search id="order_sn_">
                                    <option value="">请选择</option>
                                    {foreach $res as $k=>$v}
                                    <option value="{$v['order_sn']}">{$v['order_sn']}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        {/if}
                           <div class="layui-inline">
                          <label class="layui-form-label">申请时间</label>
                          <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="test6" placeholder="  ">
                          </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-btn-group test-table-operate-btn">
                                <button class="layui-btn" data-type="searchUserButton">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                    <table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate">
                    </table>
                    <script type="text/html" id="test-table-operate-barDemo">
                        <a class="layui-btn layui-btn-xs" lay-event="showDetail">详细信息</a> 
                      <!--   <a class="layui-btn layui-btn-xs" lay-event="affirmOrder">退款</a> -->
 
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<!--添加弹窗-->
 <div id="userDetail" style="display: none;padding:20px;">
    <form class="layui-form" action="" lay-filter="component-form-group"> 

        <div class="layui-form-item"> 
             <div class="layui-inline">
                <label class="layui-form-label">订单信息：</label>
                <div class="layui-input-block"> 
                </div>
            </div>
            <br/>
            <div class="layui-inline">
                <label class="layui-form-label">订单编号：</label>
                <div class="layui-input-block">
                    <input type="text"  id="order_sn" autocomplete="off" class="layui-input">
                </div>
            </div>
           
            <div class="layui-inline">
                <label class="layui-form-label">支付类型：</label>
                <div class="layui-input-block">
                    <input type="text" id="pay_type" autocomplete="off" class="layui-input">
                </div>
            </div> 
        </div>

        <div class="layui-form-item"> 
           <div class="layui-inline">
                <label class="layui-form-label">实付价格：</label>
                <div class="layui-input-block">
                    <input type="text" id='order_price' autocomplete="off" class="layui-input">
                </div>
            </div> 
            <div class="layui-inline">
                <label class="layui-form-label">下单时间：</label>
                <div class="layui-input-block">
                   <input type="text" id="create_time" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>  
         <div class="layui-form-item"> 
           <div class="layui-inline">
                <label class="layui-form-label">订单状态：</label>
                <div class="layui-input-block">
                    <input type="text" id='order_status' autocomplete="off" class="layui-input">
                </div>
            </div>  
        </div>  
        
          <div class="layui-form-item">  
            <div class="layui-inline">
                <label class="layui-form-label"><span id="ftitle"></span>信息：</label>
                <div class="layui-input-block"> 
                </div>
            </div>
            <br/>
            <div class="layui-inline">
                <label class="layui-form-label"><span id="ttitle"></span>名称：</label>
                <div class="layui-input-block">
                   <input type="text" id="gtour_title" autocomplete="off" class="layui-input">
                </div>
            </div>   
        </div>
      <div class="layui-form-item">  
         <div class="layui-inline">
                <label class="layui-form-label">用户信息：</label>
                <div class="layui-input-block"> 
                </div>
            </div>
            <br/>
                <div class="layui-inline">
                <label class="layui-form-label">联系人姓名:</label>
                <div class="layui-input-block">
                    <input type="text" id="linkman" autocomplete="off" class="layui-input">
                </div>
            </div>
              <div class="layui-inline">
                <label class="layui-form-label">联系人电话:</label>
                <div class="layui-input-block">
                    <input type="text" id="tel" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>   
      <div class="layui-form-item">  
         <div class="layui-inline">
                <label class="layui-form-label">退款信息：</label>
                <div class="layui-input-block"> 
                </div>
            </div>
            <br/> 
              <div class="layui-inline">
                <label class="layui-form-label">退款金额:</label>
                <div class="layui-input-block">
                    <input type="text" id="back_money_" autocomplete="off" class="layui-input">
                </div>
            </div>
              <div class="layui-inline">
                <label class="layui-form-label">退款状态:</label>
                <div class="layui-input-block">
                    <input type="text" id="refund_statuss" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
            <div class="layui-form-item">    
                <div class="layui-inline">
                <label class="layui-form-label">操作时间:</label>
                <div class="layui-input-block">
                    <input type="text" id="refund_time_" autocomplete="off" class="layui-input">
                </div>
            </div>
              <div class="layui-inline">
                <label class="layui-form-label">申请时间:</label>
                <div class="layui-input-block">
                    <input type="text" id="app_time_" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>    
    </form>
</div>
<div id="contentShow" style="display:none;padding: 30px;">
    <p id="consultation"></p>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
         layui.use('laydate', function(){
      var laydate = layui.laydate;  
      //日期范围
      laydate.render({
        elem: '#test6'
        ,range: true
      }); 
    });
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate','set'], function(){
        $ = layui.jquery;
        var table = layui.table
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,form = layui.form;

        table.render({
            elem: '#test-table-operate'
            ,url: "{:url('Order/refundlist')}"
            ,height: 'full-100'
            ,cols: [[
                {field:'refund_id',width:80,align:'center', title: 'ID'}
                ,{field:'order_sn',align:'center',title: '订单编号'}
                ,{field:'nickname',align:'center',title: '申请人'}
                ,{field:'object_name', align:'center', title: '商家'}
                ,{field:'back_money', align:'center', title: '退款金额'}
                ,{field:'create_time', align:'center', title: '申请时间'}
                ,{field:'refund_time', align:'center', title: '操作时间'}
                ,{field:'refund_status', align:'center', title: '退款状态'}
                ,{align:'center',width:150, title: '操作', toolbar: '#test-table-operate-barDemo'}
               /* ,{align:'center',width:350, title: '操作', toolbar: '#test-table-operate-barDemo'}*/
            ]]
            ,page:true
            ,limit:20
        });

        form.render(null,'component-form-group');

        laydate.render({
            elem: '#search_time'
        });

 //监听工具条
        table.on('tool(test-table-operate)', function(obj){
            var data = obj.data;
            if(obj.event === 'showDetail'){
                var loading = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                var order_sn = data.order_sn;
                var object_type = data.object_type;
                var object_id = data.object_id;
                $.ajax({
                    url: "{:url('Order/refundOrderDetail')}",
                    type: 'post',
                    dataType: 'json',
                    data: {order_sn:order_sn,object_type:object_type,object_id:object_id},
                    success: function(data){
                        layer.close(loading);
                        if (data.code === 0) {
                            if(data.data.name==""){
                                $('#gtour_title').val('未设置');
                            }else{
                                $('#gtour_title').val(data.data.name);
                            }
                                if(data.data.order_sn ==""){
                                $('#order_sn').val('未设置');
                            }else{
                                $('#order_sn').val(data.data.order_sn);
                            }
                            if(data.data.pay_type){
                                $('#pay_type').val(data.data.pay_type); 
                            }else{
                                 $('#pay_type').val('未设置');
                            }
                            if(data.data.order_status==''){
                                $('#order_status').val('未设置');
                            }else{
                                $('#order_status').val(data.data.order_status);
                            }
                            if(data.data.create_time==''){
                                $('#create_time').val('未设置');
                            }else{
                                $('#create_time').val(data.data.create_time);
                            }
                            if(data.data.tel==''){
                                $('#tel').val('未设置');
                            }else{
                                $('#tel').val(data.data.tel);
                            }
                            if(data.data.linkman==''){
                                $('#linkman').val('未设置');
                            }else{
                                $('#linkman').val(data.data.linkman);
                            }
                            if(data.data.order_price==''){
                                $('#order_price').val('未设置');
                            }else{
                                $('#order_price').val(data.data.order_price);
                            }
                            if(data.data.title==''){
                                $('#ftitle').html('未设置');
                                $('#ttitle').html('未设置');
                            }else{
                                $('#ftitle').html(data.data.title);
                                $('#ttitle').html(data.data.title);
                            } 
                            if(data.data.nickname==''){
                                $('#nickname_').val('未设置');
                            }else{
                                $('#nickname_').val(data.data.nickname);
                            }
                               if(data.data.refund_status==''){
                                $('#refund_statuss').val('未设置');
                            }else{
                                $('#refund_statuss').val(data.data.refund_status);
                            }
                               if(data.data.time==''){
                                $('#refund_time_').val('未设置');
                            }else{
                                $('#refund_time_').val(data.data.refund_time);
                            }
                               if(data.data.create_time==''){
                                $('#app_time_').val('未设置');
                            }else{
                                $('#app_time_').val(data.data.create_time);
                            }
                               if(data.data.back_money==''){
                                $('#back_money_').val('未设置');
                            }else{
                                $('#back_money_').val(data.data.back_money);
                            } 
                            var userDetailModal = layer.open({
                                title:'退款订单详情'
                                ,type: 1
                                ,shadeClose: true
                                ,area:['800px']
                                ,content: $('#userDetail')
                            });
                        }else{
                            layer.msg('获取信息失败',{icon:2,time:1000});
                        }
                    }
                })
            }else if(obj.event === 'appDetail'){
                 var loading = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                var order_id = data.order_id;

                $.ajax({
                    url: "{:url('Order/hotelOrderDetail')}",
                    type: 'post',
                    dataType: 'json',
                    data: {order_id:order_id},
                    success: function(data){
                        layer.close(loading);
                        if (data.code === 0) {
                            if(data.data.food_store_tag==""){
                                $('#hotel_name').val('未设置');
                            }else{
                                $('#hotel_name').val(data.data.hotel_name);
                            } 

                            var userDetailModal = layer.open({
                                title:'跟团评价详情'
                                ,type: 1
                                ,shadeClose: true
                                ,area:['800px']
                                ,content: $('#appDetail')
                            });
                        }else{
                            layer.msg('获取信息失败',{icon:2,time:1000});
                        }


                    }
                })
            }
        });

        var $ = layui.$, active = {
            addadmin: function() {
                window.location.href="{:url('Merchant/guideAdd')}";
            },
            searchUserButton:function(){
                var order_sn = $('#order_sn_').val();
                var refund_status = $('#refund_status_').val();
                var create_time = $("#test6").val();
                table.reload('test-table-operate', {
                    where: {
                        order_sn:order_sn,
                        refund_status:refund_status,
                        create_time:create_time
                    }
                    ,page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
                //return false;
            }
        };
        //绑定点击事件
        $('.test-table-operate-btn .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    });

</script>


</body>
</html>